class MediaInfo {
  final String title;
  final String artist;
  final String album;
  final Duration duration;
  final int width;
  final int height;
  final double frameRate;
  final String codec;
  final int bitrate;
  
  const MediaInfo({
    required this.title,
    required this.artist,
    required this.album,
    required this.duration,
    required this.width,
    required this.height,
    required this.frameRate,
    required this.codec,
    required this.bitrate,
  });
  
  factory MediaInfo.fromMap(Map<String, dynamic> map) {
    return MediaInfo(
      title: map['title'] ?? '',
      artist: map['artist'] ?? '',
      album: map['album'] ?? '',
      duration: Duration(milliseconds: map['duration'] ?? 0),
      width: map['width'] ?? 0,
      height: map['height'] ?? 0,
      frameRate: map['frameRate']?.toDouble() ?? 0.0,
      codec: map['codec'] ?? '',
      bitrate: map['bitrate'] ?? 0,
    );
  }
  
  Map<String, dynamic> toMap() {
    return {
      'title': title,
      'artist': artist,
      'album': album,
      'duration': duration.inMilliseconds,
      'width': width,
      'height': height,
      'frameRate': frameRate,
      'codec': codec,
      'bitrate': bitrate,
    };
  }
}
